<?php

namespace app\common\model;
use think\Model;


   
class CapitalFlow extends Model

{
	protected $table = 'sn_capital_flow';

	public function user() 
	{
	    return $this->belongsTo('User', 'uid', 'id');
	}
	public function account() 
    {
        return $this->belongsTo('Account', 'uid', 'uid');
    }
    public function query_log($map, $page, $size)

    {

        $arr = $this->where($map)->relation(array('user','account'))->order('time asc')->page($page, $size)->select();
        foreach ($arr as $key => $value) {
            $value['time'] = detail_time($value['time']);
        }
        $list['data'] = $arr;

        $list['total'] = $this->where($map)->count();

        $list['num'] = page_num($list['total'], $size);

        return $list;

    }

}